<template>
	<view class="ucenter-page">
		<u-navbar title-size="36" height="42" :border-bottom="false" title="我的消息"></u-navbar>
		<view class="wrap">
			<view class="u-tabs-box">
				<u-tabs-swiper activeColor="#606366" inactive-color="#606366" ref="tabs" :list="list" :current="current"
					@change="change" :is-scroll="false" swiperWidth="750" height="90" bar-width="120"
					:bar-style="barStyle" :active-item-style="activeStyle"></u-tabs-swiper>
			</view>
			<swiper class="swiper-box" :current="swiperCurrent" @transition="transition"
				@animationfinish="animationfinish">
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
						<view class="scroll-content">
							<view class="msg-cell">
								<view class="title">您有一条线索变更消息</view>
								<view class="infos">
									<view class="item">线索号：XS20210908</view>
									<view class="item">客户姓名：张**</view>
									<view class="item">线索状态：跟进中</view>
								</view>
								<view class="bottom">
									<view class="time">2021-09-08 12:56</view>
									<view class="see" @click="openUrl('/pages/index/messageDetail')">查看详情</view>
								</view>
							</view>
						</view>
					</scroll-view>
				</swiper-item>
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
						<view class="scroll-content">
							<view class="msg-cell">
								<view class="title">您有一条咨询消息</view>
								<view class="infos">
									您咨询的问题已获得回复，请点击此处查看详情
								</view>
								<view class="bottom">
									<view class="time">2021-09-08 12:56</view>
									<view class="see" @click="openUrl('/pages/index/messageDetail')">查看详情</view>
								</view>
							</view>
						</view>
					</scroll-view>
				</swiper-item>
				<swiper-item class="swiper-item">
					<scroll-view scroll-y style="height: 100%;width: 100%;">
						<view class="scroll-content">
							<view class="msg-cell">
								<view class="title">您有一条系统消息</view>
								<view class="infos">
									我是消息内容我是消息内容我是消息内容我是消息内容我是消息内容我是消息内容我是消息内容
								</view>
								<view class="bottom">
									<view class="time">2021-09-08 12:56</view>
									<view class="see" @click="openUrl('/pages/index/messageDetail')">查看详情</view>
								</view>
							</view>
						</view>
					</scroll-view>
				</swiper-item>
			</swiper>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				list: [{
						name: '线索消息'
					},
					{
						name: '咨询消息'
					},
					{
						name: '系统消息'
					}
				],
				current: 0,
				swiperCurrent: 0,
				tabsHeight: 0,
				dx: 0,
				barStyle: {
					backgroundColor: "#A2C833",
					bottom: '0rpx'
				},
				activeStyle: {
					fontWeight: 'normal'
				}
			};
		},
		onLoad() {

		},
		methods: {
			// tab栏切换
			change(index) {
				this.swiperCurrent = index;
			},
			transition({
				detail: {
					dx
				}
			}) {
				this.$refs.tabs.setDx(dx);
			},
			animationfinish({
				detail: {
					current
				}
			}) {
				this.$refs.tabs.setFinishCurrent(current);
				this.swiperCurrent = current;
				this.current = current;
			},
			openUrl(e) {
				console.log(e)
				uni.navigateTo({
					url: e
				});
			},
		}
	};
</script>
<style lang="scss">
	page {
		background-color: #F5F5F5;
	}

	.scroll-content {
		padding: 32rpx;
	}

	.msg-cell {
		background-color: #fff;
		padding: 32rpx;
		border-radius: 6rpx;

		.title {
			font-size: 32rpx;
			color: #303337;
			font-weight: 600;
			line-height: 44rpx;
			margin-bottom: 16rpx;
		}

		.infos {
			font-size: 26rpx;
			color: #606366;
			line-height: 42rpx;
			margin-bottom: 10rpx;
		}

		.bottom {
			display: flex;
			align-items: center;
			justify-content: space-between;

			.time {
				font-size: 24rpx;
				color: #9C9C9C;
			}

			.see {
				font-size: 28rpx;
				color: #A2C833;
				line-height: 40rpx;
			}
		}
	}

	.wrap {
		display: flex;
		flex-direction: column;
		height: calc(100vh - 62px);
		width: 100%;
	}

	.swiper-box {
		flex: 1;
	}

	.swiper-item {
		height: 100%;
	}
	
	// swiper{
	// 	height: calc(1005 - 45px);
	// }
</style>
